import { DslSourceEnum, DslTypeEnum, NodeTypeEnum, TriggerTypeEnum, TaskStatusEnum, WorkflowExecutionRecordStatusEnum,
  NodeToolbarTabTypeEnum, TaskParamTypeEnum }
  from './enumeration';


/**
 * @description: 类型描述
 * 2022/3/22 16:52
 * @author: zsjin
 */
/**
 * 全局参数vo
 */
export interface IGlobalParameterVo
    extends Readonly<{
        name: string;
        type: string;
        value: string | number | boolean;
    }> {
}


/**
 * 抽象值对象
 */
export interface BaseVo extends Readonly<{
    /**
     * 创建时间
     */
    createdTime: string;

    /**
     * 最后修改人
     */
    lastModifiedBy: string;

    /**
     * 最后修改时间
     */
    lastModifiedTime: string;
}> {
}

/**
 * 任务参数vo
 */
export interface ITaskParameterVo
    extends Readonly<{
        ref: string;
        expression: string;
    }> {
}

/**
 * 流程节点vo
 */
export interface IWorkflowNodeVo
    extends Readonly<{
        /**
         * 节点定义名称
         */
        name: string;
        /**
         * 节点定义描述
         */
        description?: string;
        /**
         * 节点定义
         */
        metadata?: string;
        ref: string;
        type: string;
        taskParameters: ITaskParameterVo[];
        sources: string[];
        targets: string[];
    }> {
}

/**
 * 流程执行记录vo
 */
export interface IWorkflowExecutionRecordVo extends Readonly<{
    id: string;
    serialNo: number;
    name: string;
    workflowRef: string;
    workflowVersion: string;
    description?: string;
    startTime: string;
    endTime?: string;
    status: WorkflowExecutionRecordStatusEnum | '';
    triggerId: string;
    triggerType: TriggerTypeEnum;
}> {
}

/**
 * 任务执行记录vo
 */
export interface ITaskExecutionRecordVo extends Readonly<{
    instanceId: string;
    nodeName: string;
    defKey: string;
    startTime: string;
    endTime?: string;
    status: TaskStatusEnum;
}> {
}

/**
 * 流程vo
 */
export interface IWorkflowVo
    extends Readonly<{
        name: string;
        ref: string;
        type: DslTypeEnum;
        description?: string;
        version: string;
        nodes: IWorkflowNodeVo[];
        globalParameters: IGlobalParameterVo[];
        dslText: string;
    }> {
}

/**
 * 项目详情vo
 */
export interface IProjectDetailVo
    extends Readonly<BaseVo & {
        id: string;
        dslSource: DslSourceEnum;
        dslType: DslTypeEnum;
        gitRepoId?: string;
        workflowName: string;
        workflowRef: string;
        workflowVersion: string;
        steps: number;
        dslText: string;
        eventBridgeId?: string;
        triggerType: TriggerTypeEnum;
        projectGroupId: string;
        projectGroupName: string;
    }> {
}

/**
 * 节点定义vo
 */
export interface INodeDefVo
    extends Readonly<{
        name: string;
        description?: string;
        icon?: string;
        ownerName: string;
        ownerType: string;
        ownerRef: string;
        creatorName: string;
        creatorRef: string;
        sourceLink?: string;
        documentLink?: string;
        type: string;
        workerType: NodeTypeEnum;
    }> {
}

/**
 * 任务执行记录vo
 */
export interface ITaskExecutionRecordVo extends Readonly<{
    instanceId: string;
    nodeName: string;
    defKey: string;
    startTime: string;
    endTime?: string;
    status: TaskStatusEnum;
}> {
}

/**
 * 流程执行记录vo
 */
export interface IWorkflowExecutionRecordVo extends Readonly<{
    id: string;
    serialNo: number;
    name: string;
    workflowRef: string;
    workflowVersion: string;
    description?: string;
    startTime: string;
    endTime?: string;
    status: WorkflowExecutionRecordStatusEnum | '';
    triggerId: string;
    triggerType: TriggerTypeEnum;
}> {
}

/**
 * 组件参数
 */
export interface RecordParams {
    project?: IProjectDetailVo;
    navScrollLeft: number;
    allRecords: IWorkflowExecutionRecordVo[];
    record?: IWorkflowExecutionRecordVo;
    recordDsl?: string;
    taskRecords: ITaskExecutionRecordVo[];
    nodeInfos: INodeDefVo[];
}

/**
 * 打开Webhook日志表单
 */
export interface IOpenWebhookLogForm {
    drawerVisible: boolean;
    nodeName: string;
    tabType: NodeToolbarTabTypeEnum | '';
    triggerId?: string;
    triggerType?: TriggerTypeEnum;
}

/**
 * 打开任务日志表单
 */
export interface IOpenTaskLogForm {
    drawerVisible: boolean;
    id: string;
    tabType: NodeToolbarTabTypeEnum | '';
}

/**
 * 任务参数vo
 */
export interface ITaskParamVo extends Readonly<{
    ref: string;
    type: TaskParamTypeEnum;
    valueType: string;
    value: string;
}> {
}
/**
 * 事件参数vo
 */
export interface IEventParameterVo {
    parameterId: string;
    name: string;
    type: string;
    value: string;
}

/**
 * 触发器事件vo
 */
export interface ITriggerEventVo {
    id: string;
    projectId: string;
    triggerId: string;
    triggerType: TriggerTypeEnum;
    payload: string;
    occurredTime: string;
    parameters: IEventParameterVo[];
}

